# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=stumpwm-contrib
pkgver=r515.g4613a95
pkgrel=2
pkgdesc='Collection of StumpWM modules'
arch=('any')
url='https://github.com/stumpwm/stumpwm-contrib'
license=('GPL2')
depends=('stumpwm')
makedepends=('git')
optdepends=(
  'xorg-xprop: for stumpish, the StumpWM Interactive Shell'
  'rlwrap: command completion and history in stumpish'
  'alsa-utils: manipulate the volume using amixer'
  'mpd: display information about mpd'
  'surfraw: surf the internet'
  'pass: pass integration'
  'pinentry: gnupg agent integration'
)
_commit='4613a956add7a17986a3b26c341229466cd13f1d'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  printf 'r%s.g%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  cd "$pkgname"

  install -vd "$pkgdir/usr/share/stumpwm/contrib"

  # skip useless directories/files
  find . \
    -maxdepth 1 \
    -mindepth 1 \
    -type d \
    -not -path './docs' \
    -not -path './.git' \
    -exec cp -ra {} "$pkgdir/usr/share/stumpwm/contrib" \;

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.org
}
